package com.tiancheng.trade.merchant.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.tiancheng.trade.commom.core.data.PageInfo;
import com.tiancheng.trade.commom.web.model.request.OrderMerchantSettleReqVO;
import com.tiancheng.trade.commom.web.model.response.SettlementRuleResVO;
import com.tiancheng.trade.merchant.dto.requestdto.MerchantSettleRuleRequestDTO;
import com.tiancheng.trade.merchant.model.MerchantSettleRule;

import java.util.List;

/**
 * @author kellen
 * @date 2021/7/15
 */
public interface IMerchantSettleRuleService extends IService<MerchantSettleRule> {
    /**
     * 增 - 新增即生效，同时把旧规则失效
     *
     * @param rule {@link MerchantSettleRule}
     * @return {@link Boolean}
     */
    Boolean addRule(MerchantSettleRule rule);

    PageInfo<MerchantSettleRule> queryPage(MerchantSettleRuleRequestDTO ruleRequestDTO);

    /**
     * 查询生效的商户清分规则
     *
     * @param merchantCodes
     * @return
     */
    List<SettlementRuleResVO> findByMerchantCodes(List<String> merchantCodes);


    List<SettlementRuleResVO> queryOrderMerchantSettleRule(OrderMerchantSettleReqVO orderMerchantSettleReqVO);

    void deleteByCode(String code);

    /**
     * 根据商户清分规则编码查询
     *
     * @param merchantRuleCodes 商户规则编码集合
     * @return
     */
    List<SettlementRuleResVO> findByMerchantRuleCodes(List<String> merchantRuleCodes);

    /**
     * 查询商户当前生效的清分规则
     * @param merchantCode
     * @param orgPaymentChannelId
     * @return
     */
    MerchantSettleRule currentRule(String merchantCode,Long orgPaymentChannelId);

}
